﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DingTalkAgent.Web.Areas.mobile.Controllers
{
    public class wapApiController : Controller
    {
        // GET: mobile/wabApi
        public ActionResult Index()
        {
            return Json(new resultMessage<string>() { success = true, content = "100000000000000000000000000", errorMsg = "errorMsg", errorCode = 10000, errorLevel = 1 },JsonRequestBehavior.AllowGet);
        }
        // GET: mobile/wabApi
        public ActionResult create(FormCollection form)
        {
            var aa = form;
            return Json(new resultMessage<string>() { success = true, content = "100000000000000000000000000", errorMsg = "errorMsg", errorCode = 10000, errorLevel = 1 }, JsonRequestBehavior.AllowGet);
        }

        public ActionResult Upload()
        {
            HttpPostedFileBase file = Request.Files["file"];
            if (file.ContentLength > 0)
            {
                string savePath = Server.MapPath("~/Uploads/Pictures");
                string failPath = savePath + "\\" + file.FileName;
                file.SaveAs(failPath);
                return Content("图片上传成功！");
            }
            else
            {
                return Content("未选择图片！");
            }
        }
    }
    public class resultMessage<T>
    {
        public bool success { get; set; }

        public T content { get; set; }

        public String errorMsg { get; set; }

        public int errorCode { get; set; }

        public int errorLevel { get; set; }
    }
}